package dbsucxentW.storageW.parserW;

import org.xml.sax.SAXException;

/**
 * @author Sandeep Prakash
 * Extract the branchorder and order information of nodes while parsing,
 * we can also calculate addition information like RValue from this
 */
public class BranchOrderDecorator extends NodeExtractor
{
//  protected int _prevBranchOrder = -1;
//  protected int _branchOrderCount = 1;
    
    // <editor-fold desc="Document Summary">
    /**
     * This class stores the result of the first pass (1st round of parsing)
     */
    private DocumentSummary _summary;

    public DocumentSummary getSummary() {
            return _summary;
    }
    // </editor-fold>

    /**
     * Constructor
     */
    public BranchOrderDecorator() {
        super();
        _summary = new DocumentSummary();
    }

    /*
     * Determine branch order
     */
    @Override
    protected void leaf(){
        _order++;
        _summary.processNewLeaf( _branchOrder, _order, _depth );	//to calculate M & RValue
    }

    //klarinda 20060831 - separate Attribute table
    @Override
    protected void leafAttribute(){
    }

    @Override
    public void endDocument() throws SAXException {
        _summary.summarize();
    }
}
